InsertParagraph
Inserts a paragraph at the specified position.
Syntax
expression.InsertParagraph(paragraph, sPosition, beRNewPara);
expression
- A variable that represents a ApiDrawing class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
paragraph | Required | string | ApiParagraph | |
sPosition | Required | string | The position where the text or paragraph will be inserted ("before" or "after" the drawing specified). | |
beRNewPara | Required | boolean | Defines if this method returns a new paragraph (true) or the current ApiDrawing (false). |
Returns
Example
This example inserts a paragraph at the specified position.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This graphic object with paragraph.");
let fill = Api.CreateSolidFill(Api.CreateRGBColor(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let drawing = Api.CreateShape("rect", 3212465, 963295, fill, stroke);
paragraph.AddDrawing(drawing);
paragraph = Api.CreateParagraph();
paragraph.AddText("This is a new paragraph.");
drawing.InsertParagraph(paragraph);